layui.define([ 'form', 'laydate', 'table', ], function(exports) {
	var form = layui.form;
	var table = layui.table;
    var index = layui.index;
    
   var view = {
       init:function(){
        this.initSubmit();
        
        },
       
        initSubmit:function(){
        	
        	
        	$(document).on('click','.passeord_but',function(){     
        		
        		var password= $(".password_input").val();
                var newPassword = $(".new_password_input").val();
                var oldPassword = $(".repassword_input").val();
            	
                
                if (password =='' || oldPassword == '' || newPassword == '') {
                	layer.alert('密码不能为空', {icon: 2});
					return false;
				};
                            
                           
                if( password != oldPassword){
               	   layer.alert('两次密码输入不一致', {icon: 2});
                    return false;
                };
                                       
                $.post("/user/popUserSecurity/setLoginPass.json",
                		{"newPassWord":newPassword},
                		function(data){
                	  if (data.code == "1") {
                		  layer.alert(data.message, {icon: 2});
                		  window.location.href="/user/popUserSecurity/index.do"
					}else{
						layer.alert(data.message, {icon: 2});
					} 
                });

            });
        	
        }
        
   }
     exports('setLoginPass',view);
    });